﻿using BDShop.Configuration;
using BDShop.Entities;
using BDShop.Framework;
using BDShop.Framework.Caching;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BDShop.Business.Cache
{
    public class BrandCache: BaseCache<List<Brand>>
    {
        public BrandCache()
            : base(BDShopConfiguration.Cache.CacheBrand, BrandService.GetListBrandCacheModel, true, CacheManager.GetFilePathFO(CacheEnum.brand))
        {

        }

        public static BrandCache Instance
        {
            get
            {
                return SingletonBase<BrandCache>.Instance;
            }
        }

        public static Brand GetByID(int brandID)
        {
            //Get brand from cache
            return BrandCache.Instance.Get().Where(s=>s.ID==brandID).FirstOrDefault();            
        }
    }
}
